mudbox::MeshChange Class Reference

#include <mesh.h>

Inheritance diagram for mudbox::MeshChange:

Inheritance graph
[legend]
List of all members.

Detailed Description

This class represents a change to a mesh, and is used when an operation which modifies mesh vertices should be undoable.

When you want to change the position of vertices in a mesh, and you want this change to be undoable, you should first call the function Mesh::StartChange to create a MeshChange object.


Public Member Functions

const Vector OriginalPosition (unsigned int iVertexIndex) const
  This function returns the position of a vertex before this change.
Vector  OriginalNormal (unsigned int iVertexIndex) const
  This function returns the surface normal before the change for a specified vertex.
VertexChange Add (unsigned int iVertexIndex, unsigned int iFaceIndex, bool bPrecalculateLayerIndex=false)
  Register a vertex for the change, and returns the corresponding VertexChange structure.
void  Finish (bool bUndo=true)
  This function must be called when no more vertices will be changed within the operation.

Friends

class  Mesh

Member Function Documentation

const Vector& mudbox::MeshChange::OriginalPosition unsigned int  iVertexIndex  )  const [inline]
 

This function returns the position of a vertex before this change.

Parameters:
iVertexIndex  [in] Index of the vertex
00987     {
00988         Vertex &v = m_pMesh->VertexData( iVertexIndex );
00989         if ( v.m_iStrokeID < m_iVertexCount && m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
00990             return m_pArray[v.m_iStrokeID].m_vPosition;
00991         else
00992             return v.m_vPos;
00993     };
Vector mudbox::MeshChange::OriginalNormal unsigned int  iVertexIndex  )  const [inline]
 

This function returns the surface normal before the change for a specified vertex.

Parameters:
iVertexIndex  [in] Index of the vertex
00999     {
01000         Vertex &v = m_pMesh->VertexData( iVertexIndex );
01001         if ( v.m_iStrokeID < m_iVertexCount && m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
01002             return m_pArray[v.m_iStrokeID].m_vNormal;
01003         else
01004             return v.m_vNormal;
01005     };
VertexChange& mudbox::MeshChange::Add unsigned int  iVertexIndex,
unsigned int  iFaceIndex,
bool  bPrecalculateLayerIndex = false
[inline]
 

Register a vertex for the change, and returns the corresponding VertexChange structure.

This function must be called before modifying the position of a vertex.

Parameters:
iVertexIndex  [in] Index of the vertex
iFaceIndex  [in] Index of any face which uses the vertex
bPrecalculateLayerIndex  [in] When this parameter is true, the function will precalculate the layer index of the vertex.
01026     {
01027         Vertex &v = m_pMesh->VertexData( iVertexIndex );
01028         if ( v.m_iStrokeID < m_iVertexCount && 
01029              m_pArray[v.m_iStrokeID].m_iVertexIndex == iVertexIndex )
01030             return m_pArray[v.m_iStrokeID]; // 80% of the time it hits this...
01031         else 
01032             return Add_uncached(iVertexIndex, iFaceIndex, v, bPrecalculateLayerIndex);
01033     };
void mudbox::MeshChange::Finish bool  bUndo = true  ) 
 

This function must be called when no more vertices will be changed within the operation.

Parameters:
bUndo  [in] When this parameter is true, the changes made to the vertex positions are automatically stored in the undo buffer, and becomes undoable

Friends And Related Function Documentation

friend class Mesh [friend]
 

mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange
mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange mudbox::MeshChange